package com.im.netty.codec;

import com.im.netty.protocol.Packet;
import com.im.netty.protocol.PacketCodec;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

/**
 * 
 * @author yutao
 */
public class PacketEncoder extends MessageToByteEncoder<Packet> {

	/**
	 * 
	 * @see io.netty.handler.codec.MessageToByteEncoder#encode(io.netty.channel.ChannelHandlerContext, java.lang.Object, io.netty.buffer.ByteBuf)
	 */
	@Override
	protected void encode(ChannelHandlerContext ctx, Packet msg, ByteBuf out) throws Exception {
		
		PacketCodec.INSTANCE.encode(out, msg);
	}

}
